	<div class="popup-widgets-bg" id="background" style="display:none;"></div>
	<div class="popup-widgets" id="add_rss_popup" style="display:none;">
		<h4 class="title-">Добавление RSS</h4>
		<form action="{{/}}{{community.url}}/rss_list" method="post" id="rss_form" onsubmit="return testFields();">
    <input type="hidden" name="oid" value="">
    <input type="hidden" name="lpage" value="{{lpage}}">
    <input type="hidden" name="show_all" value="{{?show_all}}yes{{/?}}">
    {{?item.oid}}
    <input type="hidden" name="from_theme" value="yes">
    {{/?}}
			<div id="form_settings" class="content- preferences-"><div class="bgg1-"><div class="bgg2-"><div class="bgg3-">
				<fieldset class="fieldset- name- text-">
					<label>Название ленты</label>
					<input type="text" value="" name="title" id="rss_form_title" />
					<div class="comment-">До 250 символов</div>
				</fieldset>
				<fieldset class="field- fieldset- url- text-">
					<label>Адрес ленты</label>
					<input type="text" value="" name="url" id="rss_form_url" />
					<div class="comment-">До 250 символов, только латинские буквы и цифры</div>
				</fieldset>
        {{?item.oid}}
        <input type="hidden" name="theme" value="{{item.oid}}">
        {{?:}}
				<fieldset class="fieldset- view- select-">
					<label>Тема</label>
					<select name="theme" id="rss_form_theme">
						{{!for themes do=@:themes_list}}
						{{:themes_list}}
						<option value="{{*oid}}">{{*title}}</option>
						{{/:themes_list}}
					</select>
				</fieldset>
        {{/?}}
			</div></div></div></div>
			<div class="buttons- js_buttons">
				<input type="image" src="{{!static type="images" "button-save-gray.gif"}}" class="button- accept-" />
				<a class="neutral- bn close_add_rss_btn" href="#"><img src="{{!static type="images" "button-cancel-gray.gif"}}" alt="Закрыть" class="cancel- button-" /></a>
			</div>
		</form>
	</div>

	<script>
	jQuery().ready(function() {
		jQuery("a.close_add_rss_btn").click(function () {
			jQuery("#add_rss_popup").hide();
			jQuery("#background").hide();
      jQuery("#rss_form_title").val("");
      jQuery("#rss_form_url").val("");
      jQuery("#rss_form_theme").val(0);
		});
		jQuery("a.add_rss_btn").click(function () {
			jQuery("#background").show();
			jQuery("#add_rss_popup").show();
		});
	});
  
  function testFields() {
    var rss_title = jQuery("#rss_form_title").val();
    rss_title = rss_title.replace(/(^\s+)|(\s+$)/g, "");
    
    if ( !/^.{0,250}$/.test(rss_title) ) {
      alert("Слишком длинное название ленты.");
      jQuery("#rss_form_title").focus();
      return false;
    }

    var rss_url = jQuery("#rss_form_url").val();
    rss_url = rss_url.replace(/(^\s+)|(\s+$)/g, "");
    
    if ( !/^.{0,250}$/.test(rss_url) ) {
      alert("Слишком длинный адрес ленты.");
      jQuery("#rss_form_url").focus();
      return false;
    }
    
    if ( !/^[a-zA-Z\d_\-\~\:\/\.\&\=\?]+$/.test(rss_url) ) {
      alert("Некорректные символы в адресе ленты.");
      jQuery("#rss_form_url").focus();
      return false;
    }
    
    return true;
  }
	</script>
